package com.eatme.web.sys.workflow.activiti.delegate.listener;

import org.activiti.engine.delegate.DelegateExecution;
import org.activiti.engine.delegate.ExecutionListener;
import org.activiti.engine.delegate.Expression;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * 执行监听器
 */
public class ActivitiExecutionListener implements ExecutionListener {

    @Autowired
    private Expression sendType;

    private static final Logger LOG = LoggerFactory.getLogger(ActivitiExecutionListener.class);
    @Override
    public void notify(DelegateExecution delegateExecution) {
        LOG.info("执行监听器:{}",delegateExecution.getId());
        if("start".equals(delegateExecution.getEventName())){
            //记录节点开始时间
        }else if("end".equals(delegateExecution.getEventName())){
            //记录节点结束时间
        }
        LOG.info("sendType:"+sendType.getValue(delegateExecution).toString());
        LOG.info("执行时长:{}");
    }
}
